package com.fingard.net.listener;

import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

/**
 * SSL服务器证书认证类
 */
public class MyX509TrustManager implements X509TrustManager {


    //该方法检查客户端的证书，若不信任该证书则抛出异常
    @Override
    public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {

    }
    //该方法检查服务器的证书，若不信任该证书同样抛出异常
    @Override
    public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {

    }
    //返回受信任的X509证书数组
    @Override
    public X509Certificate[] getAcceptedIssuers() {
        return null;
    }
}
